package com.hsc.yalebao.tabMine;

import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Bundle;
import android.text.format.DateUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.google.gson.Gson;
import com.handmark.pulltorefresh.library.ILoadingLayout;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
import com.hsc.yalebao.adapter.GetWaterRateListAdapter;
import com.hsc.yalebao.base.ActivityStack;
import com.hsc.yalebao.base.BaseActivity;
import com.hsc.yalebao.base.CustomApplication;
import com.hsc.yalebao.base.MainActivity;
import com.hsc.yalebao.http.AppConstants;
import com.hsc.yalebao.http.RequestNet;
import com.hsc.yalebao.model.GetOauthAndReturnRuleInfoBean;
import com.hsc.yalebao.model.GetWaterRateListBaseBean;
import com.hsc.yalebao.model.GetWaterRateListModel;
import com.hsc.yalebao.model.UserBaseBean;
import com.hsc.yalebao.tools.UiUtil;
import com.hsc.yalebao.weight.LogUtils;
import com.zhy.http.okhttp.callback.StringCallback;
import java.util.ArrayList;
import java.util.HashMap;
import okhttp3.Call;

public class MygetguizeActivity extends BaseActivity
{
  private String TAG = "MygetguizeActivity";
  private GetWaterRateListAdapter adapter;
  private Context context;
  private View emptyView;
  private boolean isEnd = false;
  private boolean isRefesh = true;
  private ImageView iv_title_right;
  private PullToRefreshListView mPullRefreshListView;
  private int memberid;
  View.OnClickListener onClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      switch (paramAnonymousView.getId())
      {
      default:
        return;
      case 2131099699:
      }
      CustomApplication.app.finishActivity(MygetguizeActivity.this);
    }
  };
  private int page = 1;
  private ArrayList<GetWaterRateListBaseBean> result = new ArrayList();
  private TextView tv_guize;
  private TextView tv_tishi;
  private View view_title;

  private void getVipListProfitList()
  {
    if (CustomApplication.app.userBaseBean != null)
      this.memberid = CustomApplication.app.userBaseBean.getMemberid();
    HashMap localHashMap = new HashMap();
    localHashMap.put("type", "1");
    LogUtils.d(this.TAG, "URL:" + AppConstants.URL_GET_GETWATERRATELIST);
    showLoadingDialog();
    RequestNet.get(this.context, AppConstants.URL_GET_GETWATERRATELIST, localHashMap, new StringCallback()
    {
      public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
      {
        MygetguizeActivity.this.dismissLoadingDialog();
        LogUtils.e(MygetguizeActivity.this.TAG, "获取失败,获取提现记录:" + paramAnonymousException);
        MygetguizeActivity.this.mPullRefreshListView.onRefreshComplete();
        MygetguizeActivity.this.mPullRefreshListView.setEmptyView(MygetguizeActivity.this.emptyView);
      }

      public void onResponse(String paramAnonymousString)
      {
        MygetguizeActivity.this.dismissLoadingDialog();
        MygetguizeActivity.this.mPullRefreshListView.onRefreshComplete();
        LogUtils.d(MygetguizeActivity.this.TAG, "result:" + paramAnonymousString);
        if (UiUtil.IsValueEmpty(paramAnonymousString))
        {
          LogUtils.d(MygetguizeActivity.this.TAG, "result:" + paramAnonymousString);
          MygetguizeActivity.this.mPullRefreshListView.setEmptyView(MygetguizeActivity.this.emptyView);
        }
        GetWaterRateListModel localGetWaterRateListModel;
        do
        {
          return;
          Gson localGson = new Gson();
          try
          {
            localGetWaterRateListModel = (GetWaterRateListModel)localGson.fromJson(paramAnonymousString, GetWaterRateListModel.class);
            if (localGetWaterRateListModel == null)
            {
              LogUtils.e(MygetguizeActivity.this.TAG, "获取失败");
              MygetguizeActivity.this.mPullRefreshListView.setEmptyView(MygetguizeActivity.this.emptyView);
              return;
            }
          }
          catch (Exception localException)
          {
            while (true)
            {
              localException.printStackTrace();
              localGetWaterRateListModel = null;
            }
            if (localGetWaterRateListModel.getFlag() == 0)
            {
              LogUtils.e(MygetguizeActivity.this.TAG, "returnwaterResultModel.getFlag() != 1,0,-2");
              MygetguizeActivity.this.mPullRefreshListView.setEmptyView(MygetguizeActivity.this.emptyView);
              MygetguizeActivity.this.tv_tishi.setText("暂无数据");
              return;
            }
            if (localGetWaterRateListModel.getFlag() == -2)
            {
              MygetguizeActivity.this.showDownWireDialog();
              return;
            }
            if (localGetWaterRateListModel.getFlag() == -3)
            {
              MygetguizeActivity.this.ShowFengjinDialog();
              return;
            }
            if (localGetWaterRateListModel.getFlag() == -4)
            {
              MygetguizeActivity.activityStack.backToMain(MainActivity.class, MygetguizeActivity.this.context);
              return;
            }
          }
        }
        while (localGetWaterRateListModel.getFlag() != 1);
        if (localGetWaterRateListModel.getResult() == null)
        {
          LogUtils.e(MygetguizeActivity.this.TAG, "bean.getResult() == null");
          return;
        }
        MygetguizeActivity.this.result.addAll(localGetWaterRateListModel.getResult());
        if ((MygetguizeActivity.this.result == null) || (MygetguizeActivity.this.result.size() == 0))
        {
          MygetguizeActivity.this.mPullRefreshListView.setEmptyView(MygetguizeActivity.this.emptyView);
          MygetguizeActivity.this.tv_tishi.setText("暂无数据");
        }
        MygetguizeActivity.this.adapter.setData(MygetguizeActivity.this.result);
        MygetguizeActivity.this.adapter.notifyDataSetChanged();
      }
    });
  }

  private void getoauthandreturnruleinfo()
  {
    HashMap localHashMap = new HashMap();
    LogUtils.d(this.TAG, "URL:" + AppConstants.URL_GETOAUTHANDRETURNRULEINFO);
    showLoadingDialog();
    RequestNet.get(this.context, AppConstants.URL_GETOAUTHANDRETURNRULEINFO, localHashMap, new StringCallback()
    {
      public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
      {
        MygetguizeActivity.this.dismissLoadingDialog();
      }

      public void onResponse(String paramAnonymousString)
      {
        MygetguizeActivity.this.dismissLoadingDialog();
        LogUtils.d(MygetguizeActivity.this.TAG, "getoauthandreturnruleinfo   result:" + paramAnonymousString);
        if (UiUtil.IsValueEmpty(paramAnonymousString))
          LogUtils.d(MygetguizeActivity.this.TAG, "getoauthandreturnruleinfo result:" + paramAnonymousString);
        int i;
        do
        {
          GetOauthAndReturnRuleInfoBean localGetOauthAndReturnRuleInfoBean;
          do
          {
            do
            {
              return;
              Gson localGson = new Gson();
              try
              {
                localGetOauthAndReturnRuleInfoBean = (GetOauthAndReturnRuleInfoBean)localGson.fromJson(paramAnonymousString, GetOauthAndReturnRuleInfoBean.class);
                if (localGetOauthAndReturnRuleInfoBean == null)
                {
                  LogUtils.e(MygetguizeActivity.this.TAG, "获取失败");
                  return;
                }
              }
              catch (Exception localException)
              {
                while (true)
                {
                  localException.printStackTrace();
                  localGetOauthAndReturnRuleInfoBean = null;
                }
              }
            }
            while (localGetOauthAndReturnRuleInfoBean.getFlag() == 0);
            if (localGetOauthAndReturnRuleInfoBean.getFlag() == -2)
            {
              MygetguizeActivity.this.showDownWireDialog();
              return;
            }
            if (localGetOauthAndReturnRuleInfoBean.getFlag() == -3)
            {
              MygetguizeActivity.this.ShowFengjinDialog();
              return;
            }
            if (localGetOauthAndReturnRuleInfoBean.getFlag() == -4)
            {
              MygetguizeActivity.activityStack.backToMain(MainActivity.class, MygetguizeActivity.this.context);
              return;
            }
          }
          while (localGetOauthAndReturnRuleInfoBean.getFlag() != 1);
          i = localGetOauthAndReturnRuleInfoBean.getVip_votecount();
        }
        while (i == 0);
        MygetguizeActivity.this.tv_guize.setText("1.条件：VIP分享所发展的用户每天投注满 " + i + " 次；\n2.佣金：按下线用户有效投注额为准（元宝）；");
      }
    });
  }

  private void init()
  {
    this.tv_guize = ((TextView)findViewById(2131099860));
    this.emptyView = LayoutInflater.from(this.context).inflate(2130903139, null);
    this.tv_tishi = ((TextView)this.emptyView.findViewById(2131100053));
    this.tv_tishi.setText("暂无数据");
    this.mPullRefreshListView = ((PullToRefreshListView)findViewById(2131099723));
    this.mPullRefreshListView.setMode(PullToRefreshBase.Mode.DISABLED);
    this.mPullRefreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener()
    {
      public void onRefresh(PullToRefreshBase<ListView> paramAnonymousPullToRefreshBase)
      {
        String str = DateUtils.formatDateTime(MygetguizeActivity.this.getApplicationContext(), System.currentTimeMillis(), 524305);
        paramAnonymousPullToRefreshBase.getLoadingLayoutProxy().setLastUpdatedLabel(str);
        if (MygetguizeActivity.this.mPullRefreshListView.isHeaderShown())
        {
          MygetguizeActivity.this.isRefesh = true;
          LogUtils.e(MygetguizeActivity.this.TAG, "mPullRefreshListView刷新");
          return;
        }
        MygetguizeActivity.this.isRefesh = false;
        LogUtils.e(MygetguizeActivity.this.TAG, "mPullRefreshListView加载");
        if (MygetguizeActivity.this.isEnd)
          UiUtil.showToast(MygetguizeActivity.this.context, "暂无更多数据");
        MygetguizeActivity localMygetguizeActivity = MygetguizeActivity.this;
        localMygetguizeActivity.page = (1 + localMygetguizeActivity.page);
        MygetguizeActivity.this.getVipListProfitList();
      }
    });
    if (this.adapter == null)
    {
      this.adapter = new GetWaterRateListAdapter(this.context, this.result);
      this.mPullRefreshListView.setAdapter(this.adapter);
    }
    this.adapter.notifyDataSetChanged();
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903071);
    CustomApplication.app.addActivity(this);
    this.context = this;
    setTitle(8, 0, 2130837809, "分享规则", 0, 8, 8, 0, true);
    init();
    getVipListProfitList();
    getoauthandreturnruleinfo();
  }

  protected void onResume()
  {
    super.onResume();
  }

  @SuppressLint({"NewApi"})
  public void setTitle(int paramInt1, int paramInt2, int paramInt3, String paramString, int paramInt4, int paramInt5, int paramInt6, int paramInt7, boolean paramBoolean)
  {
    View localView = findViewById(2131099716);
    if (paramBoolean)
      localView.setVisibility(0);
    while (true)
    {
      ((TextView)localView.findViewById(2131099701)).setText(paramString);
      ((TextView)localView.findViewById(2131099700)).setVisibility(paramInt1);
      ImageView localImageView = (ImageView)localView.findViewById(2131099699);
      localImageView.setVisibility(paramInt2);
      localImageView.setOnClickListener(this.onClickListener);
      localImageView.setImageResource(paramInt3);
      TextView localTextView = (TextView)localView.findViewById(2131099702);
      localTextView.setVisibility(paramInt5);
      localTextView.setOnClickListener(this.onClickListener);
      this.iv_title_right = ((ImageView)localView.findViewById(2131099704));
      this.iv_title_right.setVisibility(paramInt6);
      this.iv_title_right.setOnClickListener(this.onClickListener);
      this.iv_title_right.setImageResource(paramInt7);
      return;
      localView.setVisibility(8);
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.tabMine.MygetguizeActivity
 * JD-Core Version:    0.6.2
 */